<?php
/**
* @package GPCB
* @author caballeroantonio
* @website http://caballeroantonio.com
* @email caballeroantonio@hotmail.com
* @copyright Copyright (C) 2014. All Rights Reserved
* @license Creative Commons Attribution-NoDerivatives 4.0 International License
**/

defined('_JEXEC') or die;

function renderMessage($msgList)
{
	$buffer  = null;

	if (is_array($msgList))
	{
		foreach ($msgList as $type => $msgs)
		{
			$alert_type = strtolower($type);
			switch($alert_type){
				case 'warning':
					//:)
				break;
				case 'notice':
					$alert_type = 'info';
				break;
				case 'error':
					$alert_type = 'danger';
				break;
				default:
					$alert_type = 'success';
				break;
			}
			if (count($msgs))
			{
				foreach ($msgs as $msg)
				{
					$buffer .= "<div class=\"alert alert-{$alert_type} top-general-alert\"><span>";
					$buffer .= $msg;
					$buffer .= '</span><a type="button" class="close">&times;</a></div>';
				}
			}
		}
		return $buffer;
	}
}
